<?php  
	include('./db/dbconn.php');
	if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
		$comm_t = $_POST['comm_title'];
		$comm_title = iconv('utf-8', 'gbk', $comm_t);
		
		$comm_t_n = $_POST['comm_title_name'];
		$comm_title_name = iconv('utf-8', 'gbk', $comm_t_n);
		
		$comm_t_t = $_POST['comm_title_time'];
		$comm_title_time = iconv('utf-8', 'gbk', $comm_t_t);
		
		$comm_replay = "";
		$comm_replay_name = "";
		$comm_replay_time = "";
		
		$sql = "insert into comments(comm_title, comm_title_time, comm_title_name, comm_replay, comm_replay_name, comm_replay_time) values('$comm_title', '$comm_title_time', '$comm_title_name', '$comm_replay', '$comm_replay_name', '$comm_replay_time')";
		mysqli_query($conn, $sql);
		
		$json = array("status" => "success", "data" => "$comm_t_n", "content" => "$comm_t_t");
		echo json_encode($json);
	} else {
		$json_err = array("status" => "fail");
		echo json_encode($json_err);
	}
?>  